﻿@model Volga_It.Hotels.Models.SearchRequestModels

@{
    ViewBag.Title = "Поиск номеров";
    ViewBag.Message = "Здесь вы можете найти гостиничные номера по критериям.";
}

@section featured {
    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                <h1>@ViewBag.Title.</h1>
                <h2>@ViewBag.Message</h2>
            </hgroup> 
            <p>
               Заполните форму поиска гостиничных номеров для выдачи списка свободных номеров.
            </p>
        </div>
    </section>
}
<form id="searchFieldset" action="Home/SearchRooms" method="post">
    @Html.AntiForgeryToken()
    <div>
        @Html.LabelFor(model => model.Country)
        @Html.EditorFor(model => model.Country)
    </div>
    <div>
        @Html.LabelFor(model => model.City)
        @Html.EditorFor(model => model.City)
    </div>
    <div>
        @Html.LabelFor(model => model.Area)
        @Html.EditorFor(model => model.Area)
    </div>
    <div>
        @Html.LabelFor(model => model.ArrivalTime)
        @Html.EditorFor(model => model.ArrivalTime)
    </div>
    <div>
        @Html.LabelFor(model => model.DepartureTime)
        @Html.EditorFor(model => model.DepartureTime)
    </div>
    <div>
        @Html.LabelFor(model => model.PeoplesCount)
        @Html.EditorFor(model => model.PeoplesCount)
    </div>
    <button id="searchBtn" onclick="onSearchBtnClick()">Найти номера</button>
</form>
<script>
    function onSearchBtnClick() {
        $("#searchFieldset").submit();
        //var request = $("#searchFieldset").serialize();
        //$.ajax(
        //    {
        //        url: "Home/SearchRooms",
        //        type: "POST",
        //        data: request,
        //        dataType: "xml",
        //        success: function (result) {
        //            alert(result.code);
        //        },
        //        error: function () {
        //            alert("Ошибка AJAX запроса.");
        //        }
        //    })
    }
</script>
<style>
    fieldset{
        border: none;
    }
</style>